package com.rfsp.mcp.enums;

import com.rfsp.common.enums.SystemConst;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.rfsp.common.base.BaseEnum;

public interface McpConst {

	public static String ERR_CODE = "err_code";
	public static String ERR_MSG = "msg";

	/**
	 * 医保贷版本
	 */
	enum VersionType implements BaseEnum {

		suqian("0", "宿迁"),
		fushun("1", "抚顺"),
		zhejiang("2", "浙江"),
		other("9", "其他");

		String code;
		String msg;

		VersionType(String code, String msg) {
			this.code = code;
			this.msg = msg;
		}

		@Override
		public String getCode() {
			return code;
		}

		@Override
		public String getMsg() {
			return msg;
		}
		
		public static String getVal(String key){
			VersionType[] values = values();
			for (VersionType demoType : values) {
				if (demoType.getCode().equals(key)) {
					return demoType.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}

	}

	public static String getVersionType(String code) {
		if(StringUtils.isEmpty(code)) {
			return "0";
		}
		for(VersionType s : VersionType.values()) {
			if(code.equals(s.getCode())) {
				return s.getMsg();
			}
		}
		return code;
	}
	
	

	/**
	 * 
	 * 产品状态
	 * @author chao
	 *
	 */
	enum ProductStatus implements BaseEnum {
		wfb("1","未发布"),
		yfb("2","已发布"),
	    yty("3","已停用");
	    String code;
	    String msg;
	    ProductStatus(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		public static String getVal(String key){
			ProductStatus[] values = values();
			for (ProductStatus productStatus : values) {
				if (productStatus.getCode().equals(key)) {
					return productStatus.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
	}


	/**
	 * 还款类型
	 * @author chao
	 *
	 */
	enum RepayType implements BaseEnum {
		fqhk("0","分期还款"),
		dqhk("1","到期还款"),
	    sjsh("2","随借随还");
	    String code;
	    String msg;
	    RepayType(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		public static String getVal(String key){
			RepayType[] values = values();
			for (RepayType repayType : values) {
				if (repayType.getCode().equals(key)) {
					return repayType.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}

	/**
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum BusinessType implements BaseEnum {
		businessType0("0","保理（单笔融资）"),
		businessType1("1","保理（池化融资）"),
		businessType2("2","债权质押"),
		businessType3("3","信用贷"),
		businessType4("4","其他");
	    String code;
	    String msg;
	    BusinessType(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static BusinessType[] businessType(){
		    return BusinessType.values();
		}
		
		public static String getVal(String key){
			BusinessType[] values = values();
			for (BusinessType businessType : values) {
				if (businessType.getCode().equals(key)) {
					return businessType.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
		
	}

	/**
	 * 金融产品推送区域
	 */
	enum AreaType implements BaseEnum {
		areaType0("0","全国"),
		areaType1("1","其它");
	    String code;
	    String msg;
	    AreaType(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		public static String getVal(String key){
			AreaType[] values = values();
			for (AreaType areaType : values) {
				if (areaType.getCode().equals(key)) {
					return areaType.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
	}


	/**
	 * 两定机构类型
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum MiType implements BaseEnum {
		miType0("0","定点医疗机构"),
		miType1("1","定点零售药店"),
		miType2("2","定点长护机构"),
		miType3("3","其他");
		
	    String code;
	    String msg;
	    MiType(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static MiType[] miType(){
		    return MiType.values();
		}
		
		public static String getVal(String key){
			MiType[] values = values();
			for (MiType miType : values) {
				if (miType.getCode().equals(key)) {
					return miType.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}


	/**
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum BusinessStatus implements BaseEnum {
		businessStatus0("0","已申请"),
		businessStatus1("1","已成交");
		
	    String code;
	    String msg;
	    BusinessStatus(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static BusinessStatus[] businessStatus(){
		    return BusinessStatus.values();
		}
		
		public static String getVal(String key){
			BusinessStatus[] values = values();
			for (BusinessStatus businessStatus : values) {
				if (businessStatus.getCode().equals(key)) {
					return businessStatus.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}

	/**
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum PHYWType implements BaseEnum {
		phywType1("1","是"),
		phywType2("2","否");
		
	    String code;
	    String msg;
	    PHYWType(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static PHYWType[] phywype(){
		    return PHYWType.values();
		}
		
		public static String getVal(String key){
			PHYWType[] values = values();
			for (PHYWType phyw : values) {
				if (phyw.getCode().equals(key)) {
					return phyw.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}

	/**
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum CancelReason implements BaseEnum {
		CancelReason0("0","不需要申请融资了"),
		CancelReason1("1","变更为其他资金方"),
		CancelReason2("2","融资申请被拒绝"),
		CancelReason3("3","其他");
	    String code;
	    String msg;
	    CancelReason(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static CancelReason[] cancelReason(){
		    return CancelReason.values();
		}
		
		public static String getVal(String key){
			CancelReason[] values = values();
			for (CancelReason cancelReason : values) {
				if (cancelReason.getCode().equals(key)) {
					return cancelReason.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
	
	
	/**
	 * 医疗类别
	 * @author yubo
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum YLLB implements BaseEnum {
		
		yllb28("28","日间手术"),
		yllb4102("4102","定点特殊药品"),
		yllb5302("5302","计划生育住院"),
		yllb210303("210303","精神病住院"),
		yllb11("11","普通门诊"),
		yllb12("12","门诊挂号"),
		yllb13("13","急诊"),
		yllb1401("1401","门诊慢性病"),
		yllb1402("1402","门诊特殊病"),
		yllb1403("1403","门诊大病"),
		yllb1404("1404","门诊罕见病"),
		yllb21("21","普通住院"),
		yllb22("22","外伤住院"),
		yllb2301("2301","转外住院"),
		yllb2302("2302","异地就医"),
		yllb24("24","急诊转住院"),
		yllb4101("4101","定点药店购药"),
		yllb51("51","生育门诊"),
		yllb52("52","生育住院"),
		yllb5301("5301","计划生育门诊"),
		yllb54("54","基本医疗生育门诊"),
		yllb55("55","基本医疗生育住院"),
		yllb56("56","基本医疗计划生育手术"),
		yllb91("91","其他门诊"),
		yllb92("92","其他住院"),
		yllb93("93","其他购药"),
		yllb9901("9901","单病种"),
		yllb9902("9902","家庭病床"),
		yllb9903("9903","门诊两病"),
		yllb9904("9904","门诊特检特治(阴性)"),
		yllb9905("9905","日间病床"),
		yllb9906("9906","血液特殊病"),
		yllb9907("9907","门诊特检特治(阳性)"),
		yllb9908("9908","家庭医师签约服务"),
		yllb9909("9909","门诊专项用药");	
		
	    String code;
	    String msg;
	    YLLB(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static YLLB[] yllb(){
		    return YLLB.values();
		}
		
		public static String getVal(String key){
			YLLB[] values = values();
			for (YLLB yllb : values) {
				if (yllb.getCode().equals(key)) {
					return yllb.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
	
	
	
	/**
	 * 险种类型
	 * @author yubo
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum XZLX implements BaseEnum {
		
		XZLX310("310","职工基本医保"),
		XZLX510("510","职工生育"),
		XZLX390("390","居民医保"),
		XZLX320("320","公务员"),
		XZLX330("330","职工大额");	
		
	    String code;
	    String msg;
	    XZLX(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static XZLX[] xZLX(){
		    return XZLX.values();
		}
		
		public static String getVal(String key){
			XZLX[] values = values();
			for (XZLX xzlx : values) {
				if (xzlx.getCode().equals(key)) {
					return xzlx.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}

	/**
	 * 融资申请状态
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum FinanceStatus implements BaseEnum {
		financeStatus1("1","已申请"),
		financeStatus2("2","已成交"),
		financeStatus3("3","已终止");
		
	    String code;
	    String msg;
	    FinanceStatus(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static FinanceStatus[] financeStatus(){
		    return FinanceStatus.values();
		}
		
		public static String getVal(String key){
			FinanceStatus[] values = values();
			for (FinanceStatus financeStatus : values) {
				if (financeStatus.getCode().equals(key)) {
					return financeStatus.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}


	/**
	 *
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum AuthStatus implements BaseEnum {
		financeAuthStatus1("1","有效"),
		financeAuthStatus23("2,3","无效");
		
	    String code;
	    String msg;
	    AuthStatus(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static AuthStatus[] financeStatus(){
		    return AuthStatus.values();
		}
		
		public static String getVal(String key){
			AuthStatus[] values = values();
			for (AuthStatus authStatus : values) {
				if (authStatus.getCode().equals(key)) {
					return authStatus.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}

	/**
	 * 授权状态
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum AuthStatus123 implements BaseEnum {
		financeAuthStatus1("1","有效"),
		financeAuthStatus2("2","无效"),
		financeAuthStatus3("3","无效");
		
	    String code;
	    String msg;
	    AuthStatus123(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static AuthStatus123[] financeStatus(){
		    return AuthStatus123.values();
		}
		
		public static String getVal(String key){
			AuthStatus123[] values = values();
			for (AuthStatus123 authStatus : values) {
				if (authStatus.getCode().equals(key)) {
					return authStatus.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}

	/**
	 * 融资申请期限
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum FinanceLimit implements BaseEnum {
		financeLimit1("1","1-3月"),
		financeLimit2("2","4-6月"),
		financeLimit3("3","7-9月"),
		financeLimit4("4","10-12月"),
		financeLimit5("5","13-24月"),
		financeLimit6("6","25-36月"),
		financeLimit7("7","36月以上");
		
	    String code;
	    String msg;
	    FinanceLimit(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static FinanceLimit[] financeLimit(){
		    return FinanceLimit.values();
		}
		
		public static String getVal(String key){
			FinanceLimit[] values = values();
			for (FinanceLimit financeLimit : values) {
				if (financeLimit.getCode().equals(key)) {
					return financeLimit.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
	
	
	/**
	 * 定点机构有效性
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum YbjValidFlagDict implements BaseEnum {
		YbjValidFlagDict1("1","有效"),
		YbjValidFlagDict2("0","无效");
		
	    String code;
	    String msg;
	    YbjValidFlagDict(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static YbjValidFlagDict[] financeStatus(){
		    return YbjValidFlagDict.values();
		}
		
		public static String getVal(String key){
			YbjValidFlagDict[] values = values();
			for (YbjValidFlagDict type : values) {
				if (type.getCode().equals(key)) {
					return type.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
	
	
	/**
	 * 医疗机构类别
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum YbjOrgTypeDict implements BaseEnum {
		YbjOrgTypeDict1("1","定点医疗机构"),
		YbjOrgTypeDict2("2","定点零售药店"),
		YbjOrgTypeDict3("定点医疗机构","1"),
		YbjOrgTypeDict4("定点零售药店","2");
		
	    String code;
	    String msg;
	    YbjOrgTypeDict(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static YbjOrgTypeDict[] financeStatus(){
		    return YbjOrgTypeDict.values();
		}
		
		public static String getVal(String key){
			YbjOrgTypeDict[] values = values();
			for (YbjOrgTypeDict type : values) {
				if (type.getCode().equals(key)) {
					return type.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
	
	/**
	 * 医院等级
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum YbjOrgClassDict implements BaseEnum {
		YbjOrgClassDict1("01","三级特等"),
		YbjOrgClassDict2("02","三级甲等"),
		YbjOrgClassDict3("03","三级乙等"),
		YbjOrgClassDict4("04","三级丙等"),
		YbjOrgClassDict5("05","二级甲等"),
		YbjOrgClassDict6("06","二级乙等"),
		YbjOrgClassDict7("07","二级丙等"),
		YbjOrgClassDict8("08","一级甲等"),
		YbjOrgClassDict9("09","一级乙等"),
		YbjOrgClassDict10("10","一级丙等"),
		YbjOrgClassDict11("11","无等级"),
		YbjOrgClassDict12("12","三级无等"),
		YbjOrgClassDict13("13","二级无等"),
		YbjOrgClassDict14("14","一级无等");
		
	    String code;
	    String msg;
	    YbjOrgClassDict(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static YbjOrgClassDict[] financeStatus(){
		    return YbjOrgClassDict.values();
		}
		
		public static String getVal(String key){
			YbjOrgClassDict[] values = values();
			for (YbjOrgClassDict type : values) {
				if (type.getCode().equals(key)) {
					return type.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
	
	/**
	 * 医保区划
	 */
	@JsonFormat(shape = JsonFormat.Shape.OBJECT)
	enum YbjBizAreaDict implements BaseEnum {
		YbjBizAreaDict1("210400","抚顺市"),
		YbjBizAreaDict2("210402","新抚区"),
		YbjBizAreaDict3("210403","东洲区"),
		YbjBizAreaDict4("210404","望花区"),
		YbjBizAreaDict5("210405","机关事业"),
		YbjBizAreaDict6("210411","顺城区"),
		YbjBizAreaDict7("210421","抚顺县"),
		YbjBizAreaDict8("210422","新宾满族自治县"),
		YbjBizAreaDict9("210423","清原满族自治县"),
		YbjBizAreaDict10("210440","经济开发区"),
		YbjBizAreaDict11("210499","抚顺市市本级");
		
	    String code;
	    String msg;
	    YbjBizAreaDict(String code, String msg) {
			this.code = code;
	        this.msg  = msg;
		}
		@Override
		public String getCode() {
			return code;
		}
		@Override
		public String getMsg() {
			return msg;
		}
		
		@RequestMapping("list")
		public static YbjBizAreaDict[] financeStatus(){
		    return YbjBizAreaDict.values();
		}
		
		public static String getVal(String key){
			YbjBizAreaDict[] values = values();
			for (YbjBizAreaDict type : values) {
				if (type.getCode().equals(key)) {
					return type.getMsg();
				}
			}
			return SystemConst.EMPTY;
		}
		
	}
	
}
